﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Drawing;
using System.Drawing.Imaging;

namespace RicciWebsite
{
    /// <summary>
    /// 生成验证码
    /// </summary>
    public class verifycode : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            Hxj.Common.VerifyCode.VerifyCodeHelper config = new Hxj.Common.VerifyCode.VerifyCodeHelper();
            config.GetneralCodeImage();

            Bitmap image = config.GetneralCodeImage();
            RicciWebsite.Common.SetVerifycodeCookie(config.VerifyCodeText);            

            context.Response.ClearContent();
            context.Response.ContentType = "image/Gif";
            image.Save(context.Response.OutputStream, ImageFormat.Gif);
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
